<?php
class Profile extends Controller
{
	private $tbl = 'tbl_admin_login_info';
	
	function Profile()
	{
		parent::Controller();	
	}
	
	function index()
	{
		if($this->input->post('submit_profile'))
		{
			$this->load->model('general_model');
			$not = array('submit_profile', 're_password', 'password');
			$post = $this->general_model->get_post_array($not);
			
			$password = $this->input->post('password');
			 if(!empty($password))
				$post['password'] = md5($password);
			
			$this->general_db_model->update($this->tbl, $post, 'id = '.user_id());
			$this->session->set_flashdata('success_message', "Your Profile Successfully updated.");
			redirect(current_url());
		}
		
		$data['_user'] = $this->general_db_model->getById($this->tbl, 'id', user_id());
		$data['page_title']	= 'My Profile';
		$data['page'] = 'profile_v';
		$this->load->view('main', $data);	
	}
}
?>